-
Notifications
You must be signed in to change notification settings - Fork 131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add optional structured logs of RPC related events #66
Conversation
I was thinking that it might be useful to log two extra things - the jsonrpc I'm not sure whether these are necessary or not. If not, we can go ahead and merge. |
Yes, it's good idea to add id into req and resp logs. Did you mean id that we can get from cmd variable: |
This makes `method_into` unnecessary and allows using the `id` variable instead of reading `cmd` again. This also makes it easier to log time durations (added in a followup commit).
I made some minor formatting/refactoring suggestions and added the time duration for processing requests in a branch. What do you think? |
It looks good to me. I also updated PR description to be more verbose on why we're adding it. |
Great :) Can you apply the changes on your branch and rebase? |
I applied your changes + I changed duration timestamp field to microseconds because when I tested it I never got duration > 1s and that field was always 0. Re rebase: not sure what should I rebase on. Branch is up-to date with new-index |
Thanks! I accidentally merged without squashing, looking into fixing this |
…rogress Feature: Log every 10k blocks to help show progress during initial sync
Adding RPC related event logs that will be used in Blockstream Explorer project. The logs are structured as json object. This optional logging may be used in an enterprise/internal scenario for billing purposes. By default it's turned off.
The logs are controlled with a new
--rpc-logging
command line option. Command line option possible values, and example structured logs they produce, are as following:--rpc-logging full
results in logs:--rpc-logging no-params
excludes RPC request params to be logged, results in logs like: